package com.glsc.ngateway.common.base.repo.mysql.opmanage.report.subscribe;

import com.glsc.ngateway.common.base.domain.mysql.opmanage.report.subscribe.UserReportSubscribe;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;

import java.math.BigInteger;

/**
 * @author: qiyr
 * @date: 2022/6/2 10:47
 * @description: 用户报表订阅数据访问层
 */
@Repository
public interface UserReportSubscribeRepo extends JpaRepository<UserReportSubscribe, Long>, JpaSpecificationExecutor<UserReportSubscribe> {

    @Transactional(rollbackFor = Exception.class)
    @Modifying
    @Query(value = "DELETE FROM glsc_data.t_user_report_subscribe WHERE `id` = :id", nativeQuery = true)
    void deleteById(@Param("id") BigInteger id);

}
